package app.domain.server.util;

import java.util.HashMap;
import java.util.Map;

import app.domain.order.Order;
import app.domain.order.util.Ticket;
import app.domain.order.util.Type;

public class MarketStockPrices {

	private Map<Ticket,Double> marketStockPrices = new HashMap<>();

	public void put(Ticket ticket, double price) {
		marketStockPrices.put(ticket, price);
	}
	
	public void update(Order order, Order matchOrder) {
		if(matchOrder.getType() == Type.L) {
			marketStockPrices.put(order.getTicket(), matchOrder.getPrice());
		} else if (order.getType() == Type.L) {
			marketStockPrices.put(order.getTicket(), order.getPrice());
		}
	}

	public double get(Ticket ticket) {
		return marketStockPrices.get(ticket);
	}

	
}
